using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ManagementClinic.Data.Models.Mapping
{
    public class THANH_TOAN_TAM_UNGMap : EntityTypeConfiguration<THANH_TOAN_TAM_UNG>
    {
        public THANH_TOAN_TAM_UNGMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.NOI_DUNG)
                .HasMaxLength(1);

            this.Property(t => t.GHI_CHU)
                .HasMaxLength(100);

            this.Property(t => t.MODIFY_USER)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("THANH_TOAN_TAM_UNG");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.ID_KHACH_HANG).HasColumnName("ID_KHACH_HANG");
            this.Property(t => t.ID_PHIEU_KHAM).HasColumnName("ID_PHIEU_KHAM");
            this.Property(t => t.NOI_DUNG).HasColumnName("NOI_DUNG");
            this.Property(t => t.SO_LUONG).HasColumnName("SO_LUONG");
            this.Property(t => t.DON_GIA).HasColumnName("DON_GIA");
            this.Property(t => t.THANH_TIEN).HasColumnName("THANH_TIEN");
            this.Property(t => t.GHI_CHU).HasColumnName("GHI_CHU");
            this.Property(t => t.MODIFY_USER).HasColumnName("MODIFY_USER");
            this.Property(t => t.MODIFY_DATE).HasColumnName("MODIFY_DATE");

            // Relationships
            this.HasRequired(t => t.KHACH_HANG)
                .WithMany(t => t.THANH_TOAN_TAM_UNG)
                .HasForeignKey(d => d.ID_KHACH_HANG);
            this.HasRequired(t => t.PHIEU_KHAM)
                .WithMany(t => t.THANH_TOAN_TAM_UNG)
                .HasForeignKey(d => d.ID_PHIEU_KHAM);

        }
    }
}
